<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {

	public function __construct()
	{
		parent::__construct();

		// Restrict access to logged_in & is_admin
		if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
		{
			redirect('auth/login');
		}
	}

	public function index()
	{
		// Load language file
		$this->lang->load('admin');

		// Set page title
		$data['title'] = 'Admin Control Panel';

		// Get user details (admin)
		$data['user'] = $this->ion_auth->get_user();

		// Render the view
		$this->template->write_view('header', 'admin/header', $data, TRUE);
		$this->template->write_view('topnav', 'admin/topnav', $data, TRUE);
		$this->template->write_view('sidenav', 'admin/sidenav', $data, TRUE);
		$this->template->write_view('content', 'admin/home', $data, TRUE);
		$this->template->write_view('footer', 'admin/footer', $data, TRUE);
		$this->template->render();
	}

	public function game_settings()
	{
		// Load language file
		$this->lang->load('admin');

		// Set page title
		$data['title'] = 'Game Settings';

		// Render the view
		$this->template->write_view('header', 'admin/header', $data, TRUE);
		$this->template->write_view('topnav', 'admin/topnav', $data, TRUE);
		$this->template->write_view('sidenav', 'admin/sidenav', $data, TRUE);
		$this->template->write_view('content', 'admin/game_settings', $data, TRUE);
		$this->template->write_view('footer', 'admin/footer', $data, TRUE);
		$this->template->render();
	}
}